//
// Created by mazaiting on 2024/4/27.
//
#include <bits/stdc++.h>

#include <utility>

// 命名空间
using namespace std;

// 学生成绩元素类型
struct Stud2
{
    // 学号
    int no;
    // 姓名
    string name;
    // 分数
    int score;
    // 下一个节点
    Stud2 *next;

    // 构造函数
    Stud2() {}

    // 重载构造函数
    Stud2(int no1, string name1, int score1)
    {
        no = no1;
        name = name1;
        score = score1;
        next = NULL;
    }
};

Stud2 *head;
void Create()
{
    Stud2* p2, *p3, *p4, *p5, *p6, *p7;
    head = new Stud2(2018001, "王华", 90);
    p2 = new Stud2(2018010, "刘丽", 62);
    p3 = new Stud2(2018006, "陈明", 54);
    p4 = new Stud2(2018009, "张强", 95);
    p5 = new Stud2(2018007, "许兵", 76);
    p6 = new Stud2(2018012, "李萍", 88);
    p7 = new Stud2(2018005, "李英", 82);
    head->next = p2;
    p2->next = p3;
    p3->next = p4;
    p4->next = p5;
    p5->next = p6;
    p6->next = p7;
    p7->next = NULL;

    delete head;
    delete p2;
    delete p3;
    delete p4;
    delete p5;
    delete p6;
    delete p7;
}

// 查询序号为 i 的学生分数
int Findi(int i)
{
    if (i < 0)
        return -1;
    int j = 0;
    Stud2* p = head;
    while (j < i && p!= NULL)
    {
        j++;
        p = p->next;
    }
    if (NULL == p)
        return -1;

    return p->score;
}
















